# -*- coding: utf-8 -*-
# @Time    : 2022/1/26 10:19
# @Author  : Mr.Ye
# @Email   : a3289748713@163.com
# @File    : insert_data.py
# @Software: PyCharm

from MyVideo.models import db, Role, Admin
from datetime import datetime

if __name__ == "__main__":
    role = Role(
        name="超级管理员",
        ad_group=0,
        add_time=datetime.now(),

    )
    db.session.add(role)
    db.session.commit()
    # 使用werkzeug工具箱的密码加密功能
    # 向管理员表中插入一条数据,为超级管理员,
    # 所属角色为0
    from werkzeug.security import generate_password_hash

    admin = Admin(
        name="ysh",
        pwd=generate_password_hash("ysh123"),
        role_group=0,
        add_time=datetime.now()

    )
    db.session.add(admin)
    db.session.commit()






